<template>
  <div class="container" @click="handleBannerClose">
    <div class="wrapper">
      <swiper :options="swiperOption">
        <swiper-slide v-for="(item,index) of imgs" :key="index">
          <img class="gallary-img" :src="item" >
        </swiper-slide>
        <!-- slides -->
        <!-- Optional controls -->
       <div class="swiper-pagination"  slot="pagination"></div>
     </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'commonGallary',
  props: {
    imgs: {
      type: Array,
      default () {
        return []
      }
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination', // banner图中选中后下方显示小圆点
        paginationType: 'fraction', // 修改图标样式为 当前第几页/总页数
        observer: true, // 这就基本可以在swiper  Api里面查阅
        observeParents: true // 同上,这个是防止没点开时的图片影响到展开后图片的宽度，加了 之后自动调节
      }
    }
  },
  methods: {
    handleBannerClose () {
      this.$emit('chose')
    }
  }
}

</script>
<style lang="stylus" scoped>
  .container >>> .swiper-container
    overflow inherit
  .container
    z-index 99
    display flex
    position fixed
    flex-direction column
    justify-content center
    top 0
    left 0
    right 0
    bottom 0
    background-color #000
    .wrapper
      width: 100%
      height 0
      padding-bottom 66%
      .gallary-img
        width 100%
        height: 100%
      .swiper-pagination
        color #fff
        bottom -1rem
</style>
